/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package store;

import java.util.ArrayList;
import javax.swing.tree.DefaultMutableTreeNode;
import model.treeModel;

/**
 *
 * @author JorgeLuis
 */
public class treeStore {
    
    private ArrayList<treeModel> trees = new ArrayList<treeModel>();

    public treeStore() {
    }

    public ArrayList<treeModel> getTrees() {
        return trees;
    }

    public void setTrees(ArrayList<treeModel> trees) {
        this.trees = trees;
    }

    public void add(treeModel node) {
        trees.add(node);
       
    }

    public treeModel findNodeTree(int hashCode) {
        
        int size = trees.size();
        for (int i = 0; i < size; i++) {
            if(trees.get(i).getHastCode() == hashCode){
                return trees.get(i);
            }
        }
        return null;
    }
    
    public treeModel findIdTree(int id) {
        
        int size = trees.size();
        for (int i = 0; i < size; i++) {
            if(trees.get(i).getId() == id){
                return trees.get(i);
            }
        }
        return null;
    }
    
    public DefaultMutableTreeNode findNode(int id) {
        
        for (int i = 0; i < this.trees.size(); i++) {
            
            if(this.trees.get(i).getHastCode() == id){
                return this.trees.get(i).getNodo();
            }
        }
        
        return null;
    }
    
    
}
